/************************************************************************/
/* GUI                                                                  */
/************************************************************************/
#include "GUI/Panels/MarioInfoPanel.h"

namespace TD_GUI {



	/************************************************************************/
	/* Default definitions                                                  */
	/************************************************************************/
	const string MarioInfoPanel::m_creepInfoBackground = "GUI/Panels/creepInfo.png";
	const Coord2D MarioInfoPanel::m_infoPanelPosition(0.8035*screenWidth, 0.3762*screenHeight);
	const Coord2D MarioInfoPanel::m_infoPanelSize(0.1862*screenWidth, 0.4375*screenHeight);

	void MarioInfoPanel::initalizeMarioNames() {
		
	}

	MarioInfoPanel::MarioInfoPanel() : BasePanel(m_infoPanelPosition, m_infoPanelSize) {

		m_pImage = TD_Resources::ResourceManager::loadImage(m_creepInfoBackground);
		
		m_pCreepName = new TextMessage(m_infoPanelPosition + Coord2D(0.0139*screenWidth, 0.00625*screenHeight), "0", 
			m_defaultFont, m_defaultFontSize, Color::WHITE);

		m_pCreepLife = new TextMessage(m_infoPanelPosition + Coord2D(0.08379*screenWidth, 0.12*screenHeight), "0", 
			m_defaultFont, m_defaultFontSize, m_defaultFontColor);

		m_pCreepGold = new TextMessage(m_infoPanelPosition + Coord2D(0.08379*screenWidth, 0.204*screenHeight), "0", 
			m_defaultFont, m_defaultFontSize, m_defaultFontColor);

		m_pCreepSpeed = new TextMessage(m_infoPanelPosition + Coord2D(0.08379*screenWidth, 0.276*screenHeight), "0", 
			m_defaultFont, m_defaultFontSize, m_defaultFontColor);
		
		m_lastCreepLife = 0;
		initalizeMarioNames();

	}

	MarioInfoPanel::MarioInfoPanel(const MarioInfoPanel &rhs) {

	}

	MarioInfoPanel & MarioInfoPanel::operator =(const MarioInfoPanel & rhs) {
		return(*this);
	}

	MarioInfoPanel::~MarioInfoPanel() {
		Utils::safeDelete<TextMessage>(m_pCreepName);
		Utils::safeDelete<TextMessage>(m_pCreepGold);
		Utils::safeDelete<TextMessage>(m_pCreepLife);
		Utils::safeDelete<TextMessage>(m_pCreepSpeed);
	}

	/************************************************************************/
	/* Rendering                                                            */
	/************************************************************************/

	void MarioInfoPanel::render(SDL_Surface *const g_destSurface, unsigned int deltaTime) {
		BasePanel::render(g_destSurface, deltaTime);
		if(m_pCreep != NULL) {
			if(m_pCreep->getLife() != m_lastCreepLife) {
				updateCreepInfo();
			}
			m_pCreepName->render(g_destSurface, deltaTime);
			m_pCreepLife->render(g_destSurface, deltaTime);
			m_pCreepGold->render(g_destSurface, deltaTime);
			m_pCreepSpeed->render(g_destSurface, deltaTime);
		}
	}

	interaction_t MarioInfoPanel::processEvent(const SDL_Event &event) {
		interaction_t interaction;
		interaction.type = noInteraction;
		return(interaction);
	}
}